package {{packageName}}.infrastructure

{{#moshi}}
import com.squareup.moshi.Moshi
{{#enumUnknownDefaultCase}}
import com.squareup.moshi.adapters.EnumJsonAdapter
{{/enumUnknownDefaultCase}}
{{/moshi}}

{{#nonPublicApi}}internal {{/nonPublicApi}}{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}object SerializerHelper {
{{#moshi}}
    {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}fun addEnumUnknownDefaultCase(moshiBuilder: Moshi.Builder): Moshi.Builder {
        return moshiBuilder
{{#enumUnknownDefaultCase}}
{{#models}}
{{#model}}
{{#isEnum}}
{{#allowableValues}}
{{#enumVars}}
{{#-last}}
            .add({{modelPackage}}.{{classname}}::class.java, EnumJsonAdapter.create({{modelPackage}}.{{classname}}::class.java)
                .withUnknownFallback({{modelPackage}}.{{classname}}.{{&name}}))
{{/-last}}
{{/enumVars}}
{{/allowableValues}}
{{/isEnum}}
{{^isEnum}}
{{^isAlias}}
{{#hasEnums}}
{{#vars}}
{{#isEnum}}
{{#allowableValues}}
{{#enumVars}}
{{#-last}}
            .add({{modelPackage}}.{{classname}}.{{{nameInPascalCase}}}::class.java, EnumJsonAdapter.create({{modelPackage}}.{{classname}}.{{{nameInPascalCase}}}::class.java)
                .withUnknownFallback({{modelPackage}}.{{classname}}.{{{nameInPascalCase}}}.{{&name}}))
{{/-last}}
{{/enumVars}}
{{/allowableValues}}
{{/isEnum}}
{{/vars}}
{{/hasEnums}}
{{/isAlias}}
{{/isEnum}}
{{/model}}
{{/models}}
{{/enumUnknownDefaultCase}}
    }
{{/moshi}}
}
